package edu.nf.webapp.service;

import edu.nf.webapp.dao.UserDao;
import edu.nf.webapp.entity.User;
import edu.nf.webapp.exception.LoginException;

/**
 * @Author czl
 * @Date 2024-05-21
 */
public class LoginService {
    public User auth(String account , String password){
        UserDao dao = new UserDao();
        User user = dao.getUserByAccount(account);
        if (user != null){
            if (password.equals(user.getPassword())){
                return user;
            }
        }
        throw new LoginException(10001,"账号或者密码错误!");
    }
}
